<template>
  <div>
    <Search @search="load" @show-add-modal="showAddModal" @batch-del="batchDelete"/>
    <Table ref="table" @show-edit-modal="showEditModal"/>
    <EditModal ref="dialog" @load-data="load"/>
  </div>
</template>

<script>
import Search from './components/Search'
import Table from './components/Table'
import EditModal from './components/EditModal'
import {ConfigEntity} from "./components/object";

export default {
  name: 'crmConfig',
  components: {Search, Table, EditModal},
  mounted: function () {
    this.load({});
  },
  methods: {
    load() {
      this.$refs.table.load()
    },
    showAddModal() {
      this.$refs.dialog.open(new ConfigEntity())
    },
    batchDelete() {
      this.$refs.table.batchDelete()
    },
    showEditModal(row) {
      this.$refs.dialog.open({...row}, true)
    },
    release() {
      this.$refs.table.release()
    }
  }
}
</script>
